package com.wl156.utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;

public class Utils {
	public static void showRetryNetworkDialog(final Context context,
			DialogInterface.OnClickListener retryClickListener) {
		AlertDialog.Builder builder = new Builder(context);
		builder.setMessage("网络请求超时！");
		builder.setPositiveButton("重试", retryClickListener);
		builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				((Activity) context).finish();
			}
		});
		builder.show();
	}

	public static String anyTypeToEmpty(String ori) {
		if (ori != null && ori.equals("anyType{}")) {
			return "";
		}

		return ori;
	}
	
	
	public static String propertyToShow(Object prop) {
		if(prop == null) {
			return "";
		}
		if(prop.toString().equals("anyType{}")) {
			return "";
		}
		
		return prop.toString();
	}
}
